﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SES.CMS.BL;
using SES.CMS.DO;
using System.Data;
using System.Web.UI.HtmlControls;
namespace SES.CMS
{
    public partial class NewProducts : System.Web.UI.Page
    {
        cmsProductBL data = new cmsProductBL();
        cmsProductDO itemProductDO = new cmsProductDO();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SEO();
            }
                View();
        }
        protected void SEO()
        {
            //SEO
            Page.Title = Ultility.WebTitle();

            sysConfigDO objConfig = new sysConfigDO();
            objConfig.ConfigID = 2;

            objConfig = new sysConfigBL().Select(objConfig);


            HtmlMeta metaKey = new HtmlMeta();
            metaKey.Name = "keywords";
            metaKey.Content = objConfig.ConfigValue;
            Page.Header.Controls.Add(metaKey);


            objConfig.ConfigID = 3;
            objConfig = new sysConfigBL().Select(objConfig);
            HtmlMeta metaDesc = new HtmlMeta();
            metaDesc.Name = "description";
            metaDesc.Content = objConfig.ConfigValue;
            Page.Header.Controls.Add(metaDesc);

            Page.Title = "Sản phẩm mới | " + Ultility.WebTitle();
        }
        private void LoadNewProduct(DataTable dt)
        {
            CollectionPager1.MaxPages = 10000;

            CollectionPager1.PageSize = 28; // số items hiển thị trên một trang

            CollectionPager1.DataSource = dt.DefaultView;

            CollectionPager1.BindToControl = rptNewProduct;
            rptNewProduct.DataSource = CollectionPager1.DataSourcePaged;
            rptNewProduct.DataBind();
        }
        void View()
        {
            LoadNewProduct(new cmsProductBL().GetByIsNew(true));
        }
       
        protected string FriendlyUrl(string s)
        {
            return Ultility.Change_AV(s);
        }

    }
}